

package TimeCheck;

use strict;
use Time::HiRes;

my $DEBUG = 1;
sub new 
{
    my $proto = shift;
    my %params = @_;
    my $class = ref($proto) || $proto;
    my $self = {};

    $self->{STATEMENT} = $params{STATEMENT};
    
    bless($self, $class);    

    $self->reset;
    
    return $self;
}

sub reset
{
    my $self = shift;
    $self->{START} = Time::HiRes::time;
    if (@_) { $self->{STATEMENT} = shift; }
}

sub statement
{
    my $self = shift;
    if (@_) { $self->{STATEMENT} = shift; }
    return ($self->{STATEMENT});
}

sub show
{
    my $self = shift;
    if (@_) { $self->{STATEMENT} = shift; }
    
    my $cur_time = Time::HiRes::time;
    printf "$self->{STATEMENT},%.8f\n", $cur_time - $self->{START} if ($DEBUG);
    
    $self->{START} = $cur_time;
}

sub showtime
{
   my $self = shift;
}
